package com.hw.collection;

import java.util.Comparator;

public class GenHeap <T> extends HeapImpl<T> {

	/*
	 * constructors
	 */
	
	public GenHeap(int size, Comparator<T> com){
		super(size,com);
	}
	/************************************END CONSTRUCTORS***********************/
	/* 
	* COMPARE OBJECTS - IF NO COMPARATOR IS PASSED, THEN USE COMPARABLE.
	 */
	
	public int compareObjects(T e1, T e2){
		if(super.getComparator()!=null){
			return super.compareObjects(e1, e2);
		} else
			try {
				throw new Exception("Comparator is null");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		return 0;
	}
}
